package com.dgut.smart_house.mapper;

import com.dgut.smart_house.domain.Types;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

@Mapper
@Repository
public interface TypeMapper {

    @Select("select * from types")
    public List<Types> findAllTypes();

    @Select("select * from types where type_id=#{id}")
    public Types findByTypeId(@Param("id") Integer id);

    @Insert("insert into types(type_desc,max_num,unit) values(type_desc,max_num,unit)")
    public int createType(Types types);

    @Select("select * from types where from_node=#{fromNode}")
    public ArrayList<Types> findTypeIdByNodeId(int fromNode);
}
